package com.carleasoft.mps.cms.business.message.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.carleasoft.mps.cms.business.message.bean.entity.MessageLeading;
import com.carleasoft.mps.cms.business.message.bean.po.MessageLeadingPageQueryPo;
import com.carleasoft.mps.cms.business.message.bean.vo.MessageLeadingDetailVo;
import com.carleasoft.mps.cms.business.message.bean.vo.MessageLeadingVo;
import com.carleasoft.mps.cms.business.message.service.MessageLeadingService;
import com.carleasoft.mps.core.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 信箱首长科室信息表 前端控制器
 * </p>
 *
 * @author fan
 * @since 2023-06-09
 */
@RestController
@RequestMapping("/messageLeading")
public class MessageLeadingController {
    @Autowired
    private MessageLeadingService messageLeadingService;

    /**
     * 首长、科室信息-添加
     */
    @PostMapping("/add")
    public R add(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.add(messageLeading));
    }
    /**
     * 首长、科室信息-编辑
     */
    @PostMapping("/edit")
    public R edit(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.edit(messageLeading));
    }
    /**
     * 首长、科室信息-删除（逻辑）
     */
    @PostMapping("/delete")
    public R delete(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.delete(messageLeading));
    }
    /**
     * 首长、科室信息-查询（分页）
     */
    @PostMapping("/pageQuery")
    public R<Page<MessageLeadingVo>> pageQuery(@RequestBody MessageLeadingPageQueryPo messageLeadingPageQueryPo){
        return R.ok(messageLeadingService.pageQuery(messageLeadingPageQueryPo));
    }
    /**
     * 首长、科室信息-查询（详情）
     */
    @PostMapping("/detail")
    public R<MessageLeadingDetailVo> detail(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.detail(messageLeading));
    }
    /**
     * 首长、科室信息-查询（列表）
     */
    @PostMapping("/list")
    public R<List<MessageLeadingVo>> list(){
        return R.ok(messageLeadingService.selectList());
    }
    /**
     * 首长、科室信息-启动停止
     */
    @PostMapping("/stopOrStart")
    public R stopOrStart(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.stopOrStart(messageLeading));
    }
    /**
     * 首长、科室信息-修改排序值
     */
    @PostMapping("/editSort")
    public R editSort(@RequestBody MessageLeading messageLeading){
        return R.ok(messageLeadingService.editSort(messageLeading));
    }
}

